#pragma once
#include "NetworkHandler.h"

#include "Defines.h"
#include <irrlicht.h>
#include <string>
#include <map>
// BOOST INCLUDES
#include <boost/thread/thread.hpp>
#include "SocketCommunicator.h"
//#include <boost/shared_ptr.hpp>

class ServerHandler : public NetworkHandler
{
	private:
		std::map<std::string, ClientAddress> clientAddressMap;
		
	public:
		ServerHandler();
		
		void handleReceivedInit(const std::string& name, ClientAddress* clientAddress);
		void handleReceivedChatMessage(const std::string& name, const std::string& message, ClientAddress* clientAddress);
		void handleReceivedPlayerObject(const std::string& senderPobj, ClientAddress* clientAddress);
		void handleReceivedDisc(const std::string& name, ClientAddress* clientAddress);
		void handleReceivedRequestSeedAndTP();
		void handleReceivedRequestDismantle();
		void handleReceivedAttackObject(const std::string& name, const std::string& senderObj);
		void handleReceivedRequestRess(const std::string& name);
	private:
		void waitLoop();
		void handleReceivedMessages();
		void prepareSendQueue();
		void sendMessages();

		
};
